import { Service } from "cl-admin";
import BaseService from "@/service/base";
@Service("homeSpread")
class Spread extends BaseService {
	getParams({ dateArr, ...args }) {
		return { ...args, year: dateArr?.[0] || '', month: dateArr?.[1] || '' }
	}
	// 头部卡片
	topCards(query) {
		let params = this.getParams(query)
		return this.$get("/topCards", { params });
	}
	// 每月走势图
	monthTrend(query) {
		let params = this.getParams(query)
		return this.$get("/monthTrend", { params });
	}
	// 城市业绩排行
	cityRanking(query) {
		let params = this.getParams(query)
		return this.$get("/cityRanking", { params });
	}
	// 单城市业绩详情
	getCityMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getCityMonthData", { params });
	}
	// 渠道业绩排行
	sourceRanking(query) {
		let params = this.getParams(query)
		return this.$get("/sourceRanking", { params });
	}
	// 单渠道业绩详情
	getSourceMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getSourceMonthData", { params });
	}
	// 部门业绩排行
	deptRanking(query) {
		let params = this.getParams(query)
		return this.$get("/deptRanking", { params });
	}
	// 单部门业绩详情
	getDeptMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getDeptMonthData", { params });
	}
	// 组员业绩排行
	userRanking(query) {
		let params = this.getParams(query)
		return this.$get("/userRanking", { params });
	}
	// 组员业绩明细
	getUserMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getUserMonthData", { params });
	}
	// top10
	getTop10(query) {
		let params = this.getParams(query)
		return this.$get("/getTop10", { params });
	}

	// 清除缓存
	clearCache(query) {
		let params = this.getParams(query)
		return this.$get('/clearCache', { params })
	}
}

export default Spread;
